/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$(function () {
    //setup ajax error handling
    $.ajaxSetup({
        success: function (x, r, s) {
            console.log(x);
            if (x.state === 'redirect') {
                window.location.href = x.msg;
            }
        },
        error: function (x, status, error) {
            if (x.status === 403) {
                alert("Sorry, your session has expired. Please login again to continue");
                window.location.href = "/Account/Login";
            } else {
                alert("An error occurred: " + status + "nError: " + error);
            }
        }
    });
    $('form[ajax]').ajaxForm();
});

